#include <cstdio>
#include <algorithm>

using namespace std;

const int maxn=100000;

struct SegTree {
    int v[4*maxn+1], mark[4*maxn+1];

    void pushDown(int o, int l, int r) {
        v[o] += mark[o];
        if (l!=r) {
            mark[o*2] += mark[o];
            mark[o*2+1] += mark[o];
        }
        mark[o] = 0;
    }

    void add(int o, int l, int r, int tl, int tr, int tv) {
        pushDown(o, l, r);
        if (l==tl && r==tr) {
            mark[o] += tv;
            pushDown(o, l, r);
        } else {
            int mid=(l+r)/2;
            if (tl<=mid) add(o*2, l, mid, tl, min(tr, mid), tv);
            else pushDown(o*2, l, mid);
            if (tr>mid) add(o*2+1, mid+1, r, max(tl, mid+1), tr, tv);
            else pushDown(o*2+1, mid+1, r);

            v[o] = min(v[o*2], v[o*2+1]);
        }
    }

    int find(int o, int l, int r, int tl, int tr) {
        pushDown(o, l, r);
        int mid=(l+r)/2;
        if (l==r) return (v[o]==0)*l;
        else if (l==tl && r==tr) {
            pushDown(o*2+1, mid+1, r);
            if (v[o*2+1]==0) return find(o*2+1, mid+1, r, mid+1, r);
            else return find(o*2, l, mid, l, mid);
        } else {
            int t=0;
            if (tr>mid) t=find(o*2+1, mid+1, r, max(tl, mid+1), tr);
            if (t) return t;
            else return tl<=mid ? find(o*2, l, mid, tl, min(tr, mid)) : 0;
        }
    }
};

int main() {
    freopen("island.in", "r", stdin);
    freopen("island.out", "w", stdout);

    static int a[maxn+1];
    static SegTree sgt;
    int n, m;
    scanf("%d %d", &n, &m);
    for (int i=1; i<=n; i++) {
        scanf("%d", a+i);
        if (a[i]<i) sgt.add(1, 1, n, a[i]+1, i, 1);
    }

    for (int i=1; i<=m; i++) {
        int typ, x, y;
        scanf("%d %d", &typ, &x);
        if (typ==1) {
            scanf("%d", &y);
            if (a[x]<x) sgt.add(1, 1, n, a[x]+1, x, -1);
            a[x] = y;
            if (a[x]<x) sgt.add(1, 1, n, a[x]+1, x, 1);
        } else printf("%d\n", sgt.find(1, 1, n, 1, x));
    }

    fclose(stdin);
    fclose(stdout);
    return 0;
}
